package main

import (
	"fmt"
	"strconv"
)

func main(){
	 /*基本类型转str*/
   var n1 int = 10
	 var s1 string = strconv.FormatInt(int64(n1),10)
	 //【推荐】的转字符方   var s2 string = fmt.Sprintf("%d",n1)
	 fmt.Println(s2)
	 // %t只有在布尔类型时正常
	 var b1 bool = true
	 fmt.Printf("%t\n",b1)
	 /*string转基本类型*/
	 var s3 string = "true"
	 b2,_ := strconv.ParseBool(s3)
	 fmt.Println(b2)

	 var s4 string = "true"
	//  var s5 string = "golang"
	//  b3, err:=strconv.ParseBool(s5)
	//  fmt.Println(b3,err)
	 b3, _ :=strconv.ParseBool(s4)
	 fmt.Println(b3)
}
